package com.naiterui.ehp.bs.weixin.controller;

import com.naiterui.common.repository.page.PageParamVO;
import com.naiterui.common.repository.page.PageVO;
import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.weixin.feign.PatientFeignClient;
import com.naiterui.ehp.bs.weixin.feign.VideoConsultFeignClient;
import com.naiterui.ehp.bs.weixin.vo.ConsultSessionListVO;
import com.naiterui.ehp.bs.weixin.vo.VideoConsultRecordVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: 奈客45-MiaoHui
 * @create: 2021-05-21 13:58
 * 咨询相关接口
 **/
@Api(tags = SwaggerTag.WEIXIN + SwaggerTag.CONSULT)
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("consult")
public class ConsultController {

    private final PatientFeignClient patientFeignClient;

    private final VideoConsultFeignClient videoConsultFeignClient;

    @ApiOperation(value = "图文咨询列表")
    @GetMapping("/session/text/list")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "patientId", value = "用户id", required = true, dataType = "long", paramType = "query")
    })
    public PageVO<ConsultSessionListVO> consultSessionList(Long patientId , PageParamVO pageParamsVO) throws BusinessException {
        log.info("图文咨询列表 patientId:{}",patientId);
        return patientFeignClient.consultSessionList(patientId, pageParamsVO.getPage(), pageParamsVO.getNum());
    }

    @ApiOperation(value = "视频咨询列表")
    @GetMapping("/video/list")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "patientId", value = "用户id", required = true, dataType = "long", paramType = "query")
    })
    public PageVO<VideoConsultRecordVO> consultVideoList(Long patientId , PageParamVO pageParamsVO) throws BusinessException {
        log.info("视频咨询列表 patientId:{}",patientId);
        return videoConsultFeignClient.consultVideoList(patientId, pageParamsVO.getPage(), pageParamsVO.getNum());
    }
}
